/*
 * @Author: wangwenshuai 644586996@qq.com
 * @Date: 2023-04-25 15:46:43
 * @LastEditors: wangwenshuai 644586996@qq.com
 * @LastEditTime: 2023-06-29 11:16:16
 * @FilePath: \carbon_jee\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: wangwenshuai 644586996@qq.com
 * @Date: 2022-11-07 10:21:04
 * @LastEditors: wangwenshuai 644586996@qq.com
 * @LastEditTime: 2023-05-15 16:52:10
 * @FilePath: \CarbonPccountingProject\carbon_accounting_project\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from "vue";
import VueRouter from "vue-router";
import { TabLayout } from "@/components/Layouts";
import Index from "@/views/Index/Index.vue";
import ContactUs from "@/views/ContactUs/contactUs.vue";
import Project from "@/views/Project/project.vue";
import About from "@/views/About/about.vue";
import Test from "@/views/Test/Test.vue";
import Test1 from "@/views/Accounting/TaskMangementCopy.vue";
import Home from "@/views/Home/Home.vue";
import Login from "@/views/Login/Index.vue";
import Register from "@/views/Register/Index.vue";
// 核算任务
import FillTask from "@/views/Accounting/FillTask.vue";
import FillTask2 from "@/views/Accounting/FillTask2.vue";
import Fill from "@/views/Accounting/Fill.vue";
import Task from "@/views/Accounting/Task.vue";
import TaskPage from "@/views/Accounting/TaskPage.vue";
import TaskManagement from "@/views/Accounting/TaskManagement.vue";
import TaskReview from "@/views/flowable/task/taskReview/taskReview.vue";
import Collect from "@/views/Accounting/Collect.vue";
// 排放报告
import DataInsight from "@/views/Report/DataInsight.vue";
import PivotTable from "@/views/Report/PivotTable.vue";
import Screen from "@/views/Report/Screen.vue";
import InternalAudit from "@/views/Report/InternalAudit.vue";
import NewReports from "@/views/Report/NewReports.vue";
import ViewReport from "@/views/Report/ViewReport.vue";
import Template from "@/views/Report/Template.vue";
import TemplateEdit from "@/views/Report/TemplateEdit.vue";

// 排放核查
import ThirdParty from "@/views/Verification/ThirdParty.vue";
import Submission from "@/views/Verification/Submission.vue";
// 碳资产管理
import Overview from "@/views/Assets/Overview.vue";
import Quota from "@/views/Assets/Quota.vue";
import Fund from "@/views/Assets/Fund.vue";
import Market from "@/views/Assets/Market.vue";
import Transaction from "@/views/Assets/Transaction.vue";

// 零碳战略
import PathsandGoals from "@/views/Strategy/PathsandGoals.vue";
import EmissionReduction from "@/views/Strategy/EmissionReduction.vue";
import CarbonFootprint from "@/views/Strategy/CarbonFootprint.vue";
// 零碳课堂
import Classroom from "@/views/Classroom/Classroom.vue";
//
// 系统管理
import Department from "@/views/System/Department.vue";
import Log from "@/views/System/Log.vue";
import Menu from "@/views/System/Menu.vue";
import Operation from "@/views/System/Operation.vue";
import Process from "@/views/System/Process.vue";
import Equipment from "@/views/System/Equipment.vue";
import Roles from "@/views/System/Roles.vue";
import User from "@/views/System/User.vue";
import Boundary from "@/views/System/Boundary.vue";
import Message from "@/views/System/Message.vue";
//流程管理
import SysFormList from "@/views/flowable/SysFormList.vue";
import Formdesigner from "@/views/Formdesigner/Formdesigner.vue";
import ModelDesigner from "@/views/flowable/model/modelDesigner.vue";
import SysCustomFormList from "@/views/flowable/SysCustomFormList.vue";

import TestDemoList from "@/views/flowable/demo/TestDemoList.vue";

//系统管理
import AllTask from "@/views/flowable/task/process/all.vue";
import BackLog from "@/views/flowable/task/todo/index.vue";
import Finished from "@/views/flowable/task/finished/index.vue";
import MyTask from "@/views/flowable/task/process/index.vue";
import recordTask from "@/views/flowable/task/record/index.vue";
import Signed from "@/views/flowable/task/claim/index.vue";
import DictList from "@/views/System/DictList.vue";
import EmissionFactor from "@/views/System/EmissionFactor.vue";

// 数聚宝
// 任务管理
import Taskmanagement from "@/views/DataVaule/Taskmanagement";
// 数据填报
import Datafilling from "@/views/DataVaule/Datafilling";
import DataFillingIndex from "@/views/DataVaule/Datafilling/DataFillingIndex";
// 数据审核与校验
import AuditAndVerification from "@/views/DataVaule/AuditAndVerification";
// ESG数据透视
import Pivot from "@/views/DataVaule/Pivot";
// 模板管理
import TemplateManagement from "@/views/DataVaule/TemplateManagement";

// 知识库
// 准则框架
import StandardFramework from "@/views/KnowledgeBase/StandardFramework";
// 政策法规
import PoliciesRegulations from "@/views/KnowledgeBase/PoliciesRegulations";
// 披露规范
import DisclosureStandard from "@/views/KnowledgeBase/DisclosureStandard";
// 报告案例
import ReportCase from "@/views/KnowledgeBase/ReportCase";
// ESG字典
import ESGDictionary from "@/views/KnowledgeBase/ESGDictionary";
// ESG基础知识
import ESGBasicKnowledge from "@/views/KnowledgeBase/ESGBasicKnowledge";

// 智能建模与分析工具
// ESG智能建模
import IntelligentModeEsgim from "@/views/IntelligentMode/IntelligentModeEsgim";
// 分析工具
import AnalyticalTool from "@/views/IntelligentMode/AnalyticalTool";

// 报告专家
// ESG报告专家
import ESGReportingSpecialist from "@/views/ReportingSpecialist/ESGReportingSpecialist";

// 披露助手
// ESG披露全球公司事项
import GlobalCorporation from "@/views/DisclosureAssistant/GlobalCorporation";
// ESG披露国内公司事项
import DomesticCompany from "@/views/DisclosureAssistant/DomesticCompany";

// ESG战略
// ESG洞察力
import Insight from "@/views/EsgStrategy/Insight";
// ESG战略
import Strategy from "@/views/EsgStrategy/Strategy";

Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    component: Login,
    meta: { title: "后羿零碳-登录" },
  },
  {
    path: "/register",
    component: Register,
    meta: { title: "后羿零碳-注册" },
  },
  {
    path: "/pivottable",
    component: PivotTable,
    meta: { title: "后羿零碳-登录" },
  },
  {
    path: "/screen",
    component: Screen,
    meta: { title: "后羿零碳-大屏" },
  },
  {
    path: "/",
    component: TabLayout,
    redirect: "/home",
    children: [
      {
        path: "/home",
        name: "Home",
        component: Index,
        meta: { title: "首页" },
      },
      {
        path: "/accounting/fill",
        name: "Task",
        component: Fill,
        meta: { title: "填报核算任务" },
      },
      {
        path: "/accounting/filltask2",
        name: "Task",
        component: FillTask2,
        meta: { title: "填报核算任务" },
      },

      {
        path: "/accounting/filltask",
        name: "Task",
        component: FillTask,
        meta: { title: "填报核算任务" },
      },
      {
        path: "/accounting/task",
        name: "Task",
        component: Task,
        meta: { title: "新建核算任务" },
      },
      {
        path: "/accounting/taskpage",
        name: "TaskPage",
        component: TaskPage,
        meta: { title: "新建核算任务" },
      },
      {
        path: "/accounting/taskmanagement",
        name: "TaskManagement",
        component: TaskManagement,
        meta: { title: "核算任务管理" },
      },
      {
        path: "/accounting/test1",
        name: "test1",
        component: Test1,
        meta: { title: "测试" },
      },
      {
        path: "/accounting/taskreview",
        name: "TaskReview",
        component: TaskReview,
        meta: { title: "核算数据审核" },
      },

      {
        path: "/accounting/collect",
        name: "Collect",
        component: Collect,
        meta: { title: "核算数据审核" },
      },

      {
        path: "/report/datainsight",
        name: "DataInsight",
        component: DataInsight,
        meta: { title: "核算数据透视" },
      },
      {
        path: "/report/internalaudit",
        name: "InternalAudit",
        component: InternalAudit,
        meta: { title: "报告内部审核" },
      },
      {
        path: "/report/newreports",
        name: "NewReports",
        component: NewReports,
        meta: { title: "新建核算报告" },
      },
      {
        path: "/report/viewreport",
        name: "ViewReport",
        component: ViewReport,
        meta: { title: "查看报告" },
      },
      {
        path: "/report/template",
        name: "Template",
        component: Template,
        meta: { title: "报告模板" },
      },
      {
        path: "/report/templateEdit",
        name: "TemplateEdit",
        component: TemplateEdit,
        meta: { title: "编辑模板" },
      },

      {
        path: "/verification/thirdparty",
        name: "ThirdParty",
        component: ThirdParty,
        meta: { title: "第三方核查" },
      },
      {
        path: "/verification/Submission",
        name: "Submission",
        component: Submission,
        meta: { title: "内部审查" },
      },
      {
        path: "/assets/overview",
        name: "Overview",
        component: Overview,
        meta: { title: "碳资产总览" },
      },
      {
        path: "/assets/quota",
        name: "Quota",
        component: Quota,
        meta: { title: "碳配额管理" },
      },
      {
        path: "/assets/fund",
        name: "Fund",
        component: Fund,
        meta: { title: "资金管理" },
      },
      {
        path: "/assets/market",
        name: "Market",
        component: Market,
        meta: { title: "市场动态" },
      },
      {
        path: "/assets/transaction",
        name: "transaction",
        component: Transaction,
        meta: { title: "交易管理" },
      },

      {
        path: "/strategy/pathsandgoals",
        name: "PathsandGoals",
        component: PathsandGoals,
        meta: { title: "路径与目标" },
      },
      {
        path: "/strategy/emissionreduction",
        name: "EmissionReduction",
        component: EmissionReduction,
        meta: { title: "减排战略" },
      },
      {
        path: "/strategy/carbonfootprint",
        name: "CarbonFootprint",
        component: CarbonFootprint,
        meta: { title: "碳足迹管理" },
      },
      {
        path: "/classroom",
        name: "Classroom",
        component: Classroom,
        meta: { title: "零碳课堂" },
      },
      {
        path: "/system/department",
        name: "Department",
        component: Department,
        meta: { title: "部门管理" },
      },
      {
        path: "/system/process",
        name: "Process",
        component: Process,
        meta: { title: "流程管理" },
      },
      {
        path: "/system/boundary",
        name: "Boundary",
        component: Boundary,
        meta: { title: "排放边界管理" },
      },
      {
        path: "/system/equipment",
        name: "Equipment",
        component: Equipment,
        meta: { title: "设备管理" },
      },
      {
        path: "/system/dict",
        name: "DictList",
        component: DictList,
        meta: { title: "设备管理" },
      },

      {
        path: "/system/user",
        name: "User",
        component: User,
        meta: { title: "用户管理" },
      },
      {
        path: "/system/emissionfactor",
        name: "EmissionFactor",
        component: EmissionFactor,
        meta: { title: "用户管理" },
      },

      {
        path: "/system/menu",
        name: "Menu",
        component: Menu,
        meta: { title: "菜单管理" },
      },
      {
        path: "/system/roles",
        name: "Roles",
        component: Roles,
        meta: { title: "角色管理" },
      },
      {
        path: "/system/message",
        name: "Message",
        component: Message,
        meta: { title: "消息通知" },
      },

      {
        path: "/system/log",
        name: "Log",
        component: Log,
        meta: { title: "登录日志" },
      },
      {
        path: "/system/operation",
        name: "Operation",
        component: Operation,
        meta: { title: "操作日志" },
      },

      // 流程管理
      {
        path: "/flow/modelDesigner",
        name: "ModelDesigner",
        component: ModelDesigner,
        meta: { title: "流程模型" },
      },
      {
        path: "/flow/formList",
        name: "SysFormList",
        component: SysFormList,
        meta: { title: "表单配置" },
      },
      {
        path: "/flow/formdesigner",
        name: "Formdesigner",
        component: Formdesigner,
        meta: { title: "表单设计" },
      },
      {
        path: "/flowable/sysCustomFormList",
        name: "SysCustomFormList",
        component: SysCustomFormList,
        meta: { title: "业务表单" },
      },
      {
        path: "/flowable/demo/TestDemoList",
        name: "TestDemoList",
        component: TestDemoList,
        meta: { title: "单表流程" },
      },
      // 系统管理
      {
        path: "/process/all",
        name: "AllTask",
        component: AllTask,
        meta: { title: "所有任务" },
      },
      {
        path: "/process/mytask",
        name: "MyTask",
        component: MyTask,
        meta: { title: "我的任务" },
      },
      {
        path: "/process/todo",
        name: "BackLog",
        component: BackLog,
        meta: { title: "待办任务" },
      },
      {
        path: "/flowable/task/record/index",
        name: "recordTask",
        component: recordTask,
        meta: { title: "处理任务" },
      },
      {
        path: "/process/finished",
        name: "Finished",
        component: Finished,
        meta: { title: "已办任务" },
      },
      // 数据宝
      {
        path: "/datavaule/taskmanagement",
        name: "Taskmanagement",
        component: Taskmanagement,
        meta: { title: "数据宝——任务管理" },
      },
      {
        path: "/datavaule/datafilling",
        name: "Datafilling",
        component: Datafilling,
        meta: { title: "数据宝——数聚填报" },
      },
      {
        path: "/accounting/DataFillingIndex",
        name: "Task",
        component: DataFillingIndex,
        meta: { title: "填报任务" },
      },
      {
        path: "/datavaule/auditAndverification",
        name: "AuditAndVerification",
        component: AuditAndVerification,
        meta: { title: "数据宝——数聚审核与校验" },
      },
      {
        path: "/datavaule/pivot",
        name: "Pivot",
        component: Pivot,
        meta: { title: "数据宝——ESG数据透视" },
      },
      {
        path: "/datavaule/templatemanagement",
        name: "TemplateManagement",
        component: TemplateManagement,
        meta: { title: "数据宝——ESG模板管理" },
      },
      // 知识库
      {
        path: "/knowledgeBase/standardframework",
        name: "StandardFramework",
        component: StandardFramework,
        meta: { title: "知识库——准则框架" },
      },
      {
        path: "/knowledgebase/policiesregulations",
        name: "PoliciesRegulations",
        component: PoliciesRegulations,
        meta: { title: "知识库——政策法规" },
      },
      {
        path: "/knowledgebase/disclosurestandard",
        name: "DisclosureStandard",
        component: DisclosureStandard,
        meta: { title: "知识库——披露规范" },
      },
      {
        path: "/knowledgebase/reportcase",
        name: "ReportCase",
        component: ReportCase,
        meta: { title: "知识库——报告案例" },
      },
      {
        path: "/knowledgebase/dictionary",
        name: "ESGDictionary",
        component: ESGDictionary,
        meta: { title: "知识库——ESG字典" },
      },
      {
        path: "/knowledgebase/basicknowledge",
        name: "ESGBasicKnowledge",
        component: ESGBasicKnowledge,
        meta: { title: "知识库——ESG基础知识" },
      },
      // 智能建模与分析工具
      {
        path: "/intelligentmodelingtool/esgim",
        name: "IntelligentModeEsgim",
        component: IntelligentModeEsgim,
        meta: { title: "智能建模与分析工具——ESG智能建模" },
      },
      {
        path: "/intelligentmodelingtool/analyticaltool",
        name: "AnalyticalTool",
        component: AnalyticalTool,
        meta: { title: "智能建模与分析工具——分析工具" },
      },
      // 报告专家
      {
        path: "/reportingspecialist/esgreportingspecialist",
        name: "ESGReportingSpecialist",
        component: ESGReportingSpecialist,
        meta: { title: "报告专家——ESG报告专家" },
      },
      // 披露助手
      {
        path: "/disclosureassistant/globalcorporatematters",
        name: "GlobalCorporation",
        component: GlobalCorporation,
        meta: { title: "披露助手——ESG披露全球公司事项" },
      },
      {
        path: "/disclosureassistant/domesticcompanymatters",
        name: "DomesticCompany",
        component: DomesticCompany,
        meta: { title: "披露助手——ESG披露国内公司事项" },
      },
      // ESG战略
      {
        path: "/insightstrategy/insight",
        name: "Insight",
        component: Insight,
        meta: { title: "ESG战略——ESG洞察力" },
      },
      {
        path: "/insightstrategy/strategy",
        name: "Strategy",
        component: Strategy,
        meta: { title: "ESG战略——ESG战略" },
      },
    ],
  },
  {
    path: "/test",
    name: "test",
    component: Test,
    meta: { title: "测试" },
  },
];

//   console.log(process.env.NODE_ENV)
// router.onError((error) => {
//   const pattern = /Loading chunk (\d)+ failed/g;
//   const isChunkLoadFailed = error.message.match(pattern);
//   const targetPath = router.history.pending.fullPath;
//   if(isChunkLoadFailed){
//       router.replace(targetPath);
//   }
// })

const routerPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
  return routerPush.call(this, location).catch((err) => {});
};

//   console.log(process.env.NODE_ENV)
const router = new VueRouter({
  // mode: 'history',
  mode: "hash",
  base:
    process.env.NODE_ENV == "development"
      ? "/terraview-netzero"
      : "/terraview-netzero",
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { x: 0, y: 0 };
    }
  },
});

export default router;
